<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>

        <title>Listar Table Space</title>
        <link rel="shortcut icon" href="../Data/images/Saved-Data-Utility.ico" type="image/x-icon"/>
        <link rel="stylesheet" href="Data/CSS/content.css" type="text/css"/>

    </h:head>

    <h:body>
        <h:form id="formlistTableSpace">
                <h:panelGrid style="margin: 0 auto">
                    <p:outputLabel value="MODIFICAR TABLESPACE PERMANENT" style="color: #2480BC;"/>
                </h:panelGrid>
                
                <p:separator/>
            <p:growl id="growlMO" showDetail="true" life="10000" autoUpdate="true"/>
            <!--Area de Trabajo -->            
            <p:tabView dynamic="true" activeIndex="#{modifyTableSpaceBeanPermanent.index}" id="tabViewMo">
                <p:tab title="Table Spaces" disabled="#{modifyTableSpaceBeanPermanent.disabledParent}"> 
                    <p:dataTable id="dataTableTS" var="tablespace" value="#{modifyTableSpaceBeanPermanent.mediumTableSpaceModel}" 
                                 paginator="true" rows="15"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                 rowsPerPageTemplate="5,10,15"
                                 selection="#{modifyTableSpaceBeanPermanent.selectedtablespace}"
                                 selectionMode="single">
                        <f:facet name="header"> 
                            Espacios Logicos
                        </f:facet>

                        <p:column headerText="Tablespace">  
                            <h:outputText value="#{tablespace.name}" />  
                        </p:column>  

                        <p:column headerText="Init Ext">  
                            <h:panelGroup rendered="#{tablespace.initialExt == -1}">
                                <h:outputText value="NULL" />  
                            </h:panelGroup>
                            <h:panelGroup rendered="#{tablespace.initialExt!=-1}">
                                <h:outputText value="${tablespace.initialExt}" />  
                            </h:panelGroup>
                        </p:column>  

                        <p:column headerText="Next Ext">   
                            <h:panelGroup rendered="#{tablespace.nextExt == -1}">
                                <h:outputText value="NULL" />  
                            </h:panelGroup>

                            <h:panelGroup rendered="#{tablespace.nextExt!=-1}">
                                <h:outputText value="${tablespace.nextExt}" />  
                            </h:panelGroup>
                        </p:column>

                        <p:column headerText="Min Ext">  

                            <h:panelGroup rendered="#{tablespace.minExt == -1}">
                                <h:outputText value="NULL" />  
                            </h:panelGroup>

                            <h:panelGroup rendered="#{tablespace.minExt!=-1}">
                                <h:outputText value="${tablespace.minExt}" />  
                            </h:panelGroup>

                        </p:column>

                        <p:column headerText="Max Ext">  
                            <h:panelGroup rendered="#{tablespace.maxExt == -1}">
                                <h:outputText value="NULL" />  
                            </h:panelGroup>

                            <h:panelGroup rendered="#{tablespace.maxExt!=-1}">
                                <h:outputText value="${tablespace.maxExt}" />  
                            </h:panelGroup>
                        </p:column>

                        <p:column headerText="% Inc">   
                            <h:panelGroup rendered="#{tablespace.pctIncrease == -1}">
                                <h:outputText value="NULL" />  
                            </h:panelGroup>

                            <h:panelGroup rendered="#{tablespace.pctIncrease!=-1}">
                                <h:outputText value="${tablespace.pctIncrease}" />  
                            </h:panelGroup>
                        </p:column>
                    </p:dataTable>
                    
                    <br/>

                    <h:panelGrid style="margin: 0 auto" columns="1" >

                        <p:commandButton value="Editar" 
                                         action="#{modifyTableSpaceBeanPermanent.changeTab}" 
                                         update="tabViewMo"/>
                        
                    </h:panelGrid>

                </p:tab>

                <p:tab title="Edición" disabled="#{modifyTableSpaceBeanPermanent.disabled}"> 

                    <h:panelGrid columns="2" cellpadding="10">
                        
                        <p:outputLabel value="Nombre:" /> 
                        <p:outputLabel value="#{modifyTableSpaceBeanPermanent.newNameTableSpace}" />  

                        <p:outputLabel value="Estado:"/>
                        <p:selectOneRadio id="onlineOptions" value="#{modifyTableSpaceBeanPermanent.online}" columns="2">  
                            <p:ajax event="valueChange" listener="#{modifyTableSpaceBeanPermanent.updateModoDisabledState}" update="modeOptions"/>
                            <f:selectItem itemLabel="Online&nbsp;&nbsp;&nbsp;" itemValue="true" />  
                            <f:selectItem itemLabel="Offline" itemValue="false" />  
                        </p:selectOneRadio> 
                        
                        <p:outputLabel value="Modo:"/>
                        <p:selectOneRadio id="modeOptions" value="#{modifyTableSpaceBeanPermanent.mode}" columns="2" disabled="#{modifyTableSpaceBeanPermanent.modeOptionsDisabled}">  
                            <f:selectItem itemLabel="Solo Lectura&nbsp;&nbsp;&nbsp;" itemValue="true" />  
                            <f:selectItem itemLabel="Lectura y Escritura" itemValue="false" />  
                        </p:selectOneRadio> 

                        <p:commandButton value="Confirmar" action="#{modifyTableSpaceBeanPermanent.modifyTablespace()}" update="tabViewMo,dataFileData,dataFleSpaceData"/>
                        <p:commandButton value="Cancelar" 
                                         action="#{modifyTableSpaceBeanPermanent.cancel}" 
                                         update="tabViewMo"/>

                    </h:panelGrid>

                </p:tab>

                <p:tab title="Agregar Data File" disabled="#{modifyTableSpaceBeanPermanent.disabled}"> 

                    <p:dataTable id="dataFileData" var="dataFile" 
                                 value="#{modifyTableSpaceBeanPermanent.mediumDataFileModel}" 
                                 paginator="true" rows="15"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                 rowsPerPageTemplate="5,10,15">
                        <p:column headerText="Nombre">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.name}" />  
                        </p:column>
                        <p:column headerText="ID">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.ID}" />  
                        </p:column>
                        <p:column headerText="Tablespace">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.tableSpace}" />  
                        </p:column>  
                        <p:column headerText="Modo">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.estado}" />  
                        </p:column>
                        <p:column headerText="Estado">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.onlineEstado}" />  
                        </p:column>
                        <p:column headerText="Tamaño Bytes">                                  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.tamano}" />  
                        </p:column>
                        <p:column headerText="Extension">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.incremento}" />  
                        </p:column>
                    </p:dataTable>
                    
                    <center>

                        <h:panelGrid columns="5" cellpadding="10">


                            <p:outputLabel value="Nombre:" /> 
                            <p:inputText value="#{modifyTableSpaceBeanPermanent.nameDataFile}" />  

                            <p:outputLabel value="Tamaño:" /> 
                            <p:inputText value="#{modifyTableSpaceBeanPermanent.sizeDataFile}" />  
                            
                            <p:selectOneRadio id="sizeOptions" value="#{modifyTableSpaceBeanPermanent.dataFileSizeOption}" columns="3">  
                                <f:selectItem itemLabel="&nbsp;K&nbsp;&nbsp;&nbsp;" itemValue="K" />  
                                <f:selectItem itemLabel="&nbsp;M&nbsp;&nbsp;&nbsp;" itemValue="M" />
                                <f:selectItem itemLabel="&nbsp;G&nbsp;&nbsp;&nbsp;" itemValue="G" />
                            </p:selectOneRadio> 

                        </h:panelGrid>
                        
                        <h:panelGrid columns="2" cellpadding="10">

                            <p:commandButton value="Agregar" action="#{modifyTableSpaceBeanPermanent.addDataFile()}" update="tabViewMo,dataFileData,dataFleSpaceData"/>

                            <p:commandButton value="Cancelar" 
                                             action="#{modifyTableSpaceBeanPermanent.cancel}" 
                                             update="tabViewMo"/>
                            
                        </h:panelGrid>

                    </center>

                </p:tab>
                
                <p:tab title="Eliminar Data File" disabled="#{modifyTableSpaceBeanPermanent.disabled}"> 

                    <p:dataTable id="dataFleSpaceData" var="dataFile" 
                                 value="#{modifyTableSpaceBeanPermanent.mediumDataFileModel}" 
                                 paginator="true" rows="15"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                 rowsPerPageTemplate="5,10,15"
                                 selection="#{modifyTableSpaceBeanPermanent.selectedDataFile}"
                                 selectionMode="single">
                        <p:column headerText="Nombre">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.name}" />  
                        </p:column>
                        <p:column headerText="ID">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.ID}" />  
                        </p:column>
                        <p:column headerText="Tablespace">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.tableSpace}" />  
                        </p:column>  
                        <p:column headerText="Modo">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.estado}" />  
                        </p:column>
                        <p:column headerText="Estado">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.onlineEstado}" />  
                        </p:column>
                        <p:column headerText="Tamaño Bytes">                                  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.tamano}" />  
                        </p:column>
                        <p:column headerText="Extension">  
                            <h:outputText style="font-size: 11pt" value="#{dataFile.incremento}" />  
                        </p:column>
                    </p:dataTable>

                    <center>

                        <h:panelGrid columns="3" cellpadding="10">
                            
                            <p:commandButton value="Drop" style="color: #2480BC;"  action="#{modifyTableSpaceBeanPermanent.deleteDataFile()}" update="tabViewMo,dataFileData,dataFleSpaceData">
                                <p:confirm header="Confirmation" message="Esta Seguro de Eliminar el DataFile de este TableSpace?" icon="ui-icon-alert" /> 
                            </p:commandButton>
                            
                            <p:confirmDialog global="true" showEffect="fade" hideEffect="explode">  
                                <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>  
                                <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>       
                            </p:confirmDialog> 
                            
                            <p:commandButton value="Cancelar" 
                                             action="#{modifyTableSpaceBeanPermanent.cancel}" 
                                             update="tabViewMo"/>

                        </h:panelGrid>

                    </center>

                </p:tab>
            </p:tabView>
        </h:form>
    </h:body>
</html>
